<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>组件的分离写法</title>
  </head>
  <body>
    <div id="app">
      <cpn1></cpn1>
      <cpn2></cpn2>
    </div>

    <!-- 1.script标签，注意类型：text/x-template -->
    <script type="text/x-template" id="cpn">
      <div>
          <h2>我是标题</h2>
          <p>不动手机</p>
      </div>
    </script>

    <!-- 2.template标签 -->
    <template id="cpn2">
      <div>
        <h2>我不是标题</h2>
        <p>动动可以吗？</p>
      </div>
    </template>
    <script src="../vue.js"></script>
    <script>
      //注册一个全局组件
      Vue.component("cpn1", {
        template: "#cpn",
      });
      Vue.component("cpn2", {
        template: "#cpn2",
      });
      const app = new Vue({
        el: "#app",
        data: {
          messahe: "hello",
        },
      });
    </script>
  </body>
</html>
